def can_place_flowers(flowerbed, n):
    count = 0
    length = len(flowerbed)

    for i in range(length):
        if flowerbed[i] == 0:
            # 检查左边和右边是否都是 0 或者是边界
            if (i == 0 or flowerbed[i - 1] == 0) and (i == length - 1 or flowerbed[i + 1] == 0):
                flowerbed[i] = 1  # 种下花
                count += 1
                if count >= n:
                    return True

    return count >= n